home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
ab20
/
ab20_archive
/
datacomm
/
vltjr-5.045.lzh
/
rexx
/
Intercept.vlt
< prev
next >
Wrap
Text File
|
1991-02-05
|
1KB
|
49 lines
/** Intercept.vlt
*
* Example program to intercept keystrokes.
* Changes lower case b's into upper case C's, until you type a lower case a.
*
**/
/*
* Open a port
*/
mp = openport(FOOBAR)
"message (Now type some lower case b's and other stuff.*NType a lower case a to get out.)"
/*
* Tell VLT to send us stuff
*/
"wedge keystrokes FOOBAR"
/*
* Loop until quitflag is 1, waiting for packets
*/
do forever
if quitflag = 1 then leave
t = waitpkt(FOOBAR)
/*
* We got a number of packets. Loop over all of them.
*/
do ff = 1
p = getpkt(FOOBAR)
if c2d(p) = 0 then leave ff
line = getarg(p)
/*
* Got a line. It is of the form: KEYSTROKE code qualifier iaddress character
* parse it out.
*/
parse var line command code qual iaddr char .
/*
* If we got an "a", quit. If a "b", say that we'll handle this one
* ourselves by replying a 0 error return and replace it with a capital C!
* Otherwise return a 1.
*/
if char = 'a' then quitflag = 1
if char = 'b' then do
t = reply(p, 0)
if (char = 'b') then address VLT "send (C); emit (C);"
end
else t = reply(p, 1)
end
end